package com.wensi.lib_network.intercepter

import android.util.Log
import okhttp3.Interceptor
import okhttp3.Response

/**
 * 拦截器
 */
class HttpInterceptor: Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
        val response = chain.proceed(request)

        Log.i("HttpInterceptor", "==============天气查询request===================")
        if (request.method() == "GET") {
            Log.i("HttpInterceptor", request.body().toString())
        }
        Log.i("HttpInterceptor", "==============天气查询response===================")
        response.body()?.toString()?.let { Log.i("HttpInterceptor", it) }

        return response
    }
}